package com.example.helloapp;

import java.io.*;

public class test {
    public static void main(String[] args) {
        File file=new File(pathname:"Hello1.txt");

        try(FileWriter writer=new FileWriter((file))){
            writer.write(str:"This\n is\n an\n example\n");
            writer.flush();
        }catch(IOException e){
            e.printStackTrace();
        }

        try (FileReader fr=new FileReader((file))){
            char[] a=new char[50];
            fr.read(a);
            for(char c:a){
                System.out.print(c);
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}

